import java.util.Random;

/**
 * 实现runnable接口，重写run方法
 */
public class MyRunnable implements Runnable{
    @Override
    public void run() {
        Random random=new Random();
        while(true){
            System.out.println(Thread.currentThread().getName());
            try {
                Thread.sleep(random.nextInt(10));
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
